package cn.eleven.service.impl;

import cn.eleven.entity.ForumPost;
import cn.eleven.mapper.ForumPostMapper;
import cn.eleven.service.ForumPostService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ForumPostServiceImpl implements ForumPostService {

    @Autowired
    private ForumPostMapper postMapper;

    @Override
    public List<ForumPost> getPostsByUserId(Integer userId) {
        return postMapper.selectList(new QueryWrapper<ForumPost>().eq("user_id", userId));
    }

    @Override
    public void deletePostById(Integer postId) {
        postMapper.deleteById(postId);
    }
}